package com.caishi.lkx.course.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zzw.common.entity.impl.BaseEntity;
import com.zzw.common.service.model.base.SortModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;



@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "kc_video_info", autoResultMap = true)
@Schema(title = "视频信息")
public class VideoInfoModel extends BaseEntity<VideoInfoModel> implements
        SortModel<VideoInfoModel>{

    /**
     * 科目名称
     */
    private String name;

    /**
     * 阿里云视频id
     */
    private String aliyunVideoId;

    /**
     * 时长
     */
    @Schema(name = "总时长")
    private Long duration;

    private Long categoryId;

    private String serverName;

    private Integer sort;

    private String coverImg;

    private String teacherId;


    @TableField(exist = false)
    private String categoryName;

    @TableField(exist = false)
    private String chapterName;

    private String chapterId;

    @Schema(name = "观看时长")
    @TableField(exist = false)
    private Long watchDuration;
    @Schema(name = "是否完结")
    @TableField(exist = false)
    private Boolean fs;

    /**
    * 观看视频记录id
    * */
    @TableField(exist = false)
    private Integer recordsId;
    /**
     *
     * */
    @TableField(exist = false)
    private String columnId;

    @Override
    public int hashCode() {
        return getId().hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof VideoInfoModel gr) return gr.getId().equals(this.getId());
        return super.equals(obj);
    }
}
